<?php

namespace App\Facades\Location;

use Faker\Factory;

class Location
{
    public function getIp()
    {
        return $this->getName(__FUNCTION__) . ':' . Factory::create()->ipv4;
    }

    public function getCountry()
    {
        return $this->getName(__FUNCTION__) . ':' . Factory::create()->century;
    }

    public function getLanguage()
    {
        return $this->getName(__FUNCTION__) . ':' . Factory::create()->languageCode;
    }

    public function getName($name = 'unknown')
    {
        return preg_replace('/^[a-z]*([A-Z].*)$/', '$1', $name);
    }
}
